package com.xcw.bos.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xcw.bos.dao.IRegionDao;
import com.xcw.bos.domain.Region;
import com.xcw.bos.page.PageBean;
import com.xcw.bos.service.IRegionService;
/**
 * 区域操作Service
 * @author xcw
 *
 */
@Service
@Transactional
public class RegionServiceImpl implements IRegionService {

	@Autowired
	private IRegionDao regionDao;
	//批量插入区域数据
	@Override
	public void pageQuery(PageBean<Region> pageBean) {
		regionDao.pageQuery(pageBean);

	}

	@Override
	public void saveBatch(List<Region> list) {
		for(Region region : list){
			regionDao.save(region);
		}

	}

	@Override
	public List<Region> findAll() {
		return regionDao.findAll();
	}

	@Override
	public List<Region> findByQ(String q) {
		
		return regionDao.findByNamedQuery("findByQ", "%"+q+"%","%"+q+"%","%"+q+"%");
	}

}
